home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / NetworkSetup.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  50.1 KB  |  1,487 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        NetworkSetup.h
  3.  
  4.      Contains:    Network Setup Interfaces
  5.  
  6.      Version:    Technology:    1.1.0
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1998-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __NETWORKSETUP__
  18. #define __NETWORKSETUP__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __FILES__
  25.     #include <Files.h>
  26. #endif
  27.  
  28. #ifndef __OPENTRANSPORT__
  29.     #include <OpenTransport.h>
  30. #endif
  31.  
  32. #ifndef __OPENTRANSPORTPROVIDERS__
  33.     #include <OpenTransportProviders.h>
  34. #endif
  35.  
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59. #if CALL_NOT_IN_CARBON
  60. #ifndef __NETWORKSETUPTYPES__
  61. #define __NETWORKSETUPTYPES__
  62. typedef struct OpaqueCfgDatabaseRef*     CfgDatabaseRef;
  63. typedef UInt32                             CfgAreaID;
  64. typedef OSType                             CfgEntityClass;
  65. typedef OSType                             CfgEntityType;
  66.  
  67. struct CfgEntityRef {
  68.     CfgAreaID                         fLoc;
  69.     UInt32                             fReserved;
  70.     Str255                             fID;
  71. };
  72. typedef struct CfgEntityRef                CfgEntityRef;
  73.  
  74. struct CfgResourceLocator {
  75.     FSSpec                             fFile;
  76.     UInt16                             fResID;
  77. };
  78. typedef struct CfgResourceLocator        CfgResourceLocator;
  79.  
  80. struct CfgEntityInfo {
  81.     CfgEntityClass                     fClass;
  82.     CfgEntityType                     fType;
  83.     Str255                             fName;
  84.     CfgResourceLocator                 fIcon;
  85. };
  86. typedef struct CfgEntityInfo            CfgEntityInfo;
  87.  
  88. typedef void *                            CfgEntityAccessID;
  89.  
  90. struct CfgPrefsHeader {
  91.     UInt16                             fSize;                        /* size includes this header*/
  92.     UInt16                             fVersion;
  93.     OSType                             fType;
  94. };
  95. typedef struct CfgPrefsHeader            CfgPrefsHeader;
  96. /*    -------------------------------------------------------------------------
  97.     Error codes
  98.     ------------------------------------------------------------------------- */
  99. enum {
  100.     kCfgErrDatabaseChanged        = -3290,                        /* database has changed since last call - close and reopen DB*/
  101.     kCfgErrAreaNotFound            = -3291,                        /* Area doesn't exist*/
  102.     kCfgErrAreaAlreadyExists    = -3292,                        /* Area already exists*/
  103.     kCfgErrAreaNotOpen            = -3293,                        /* Area needs to open first*/
  104.     kCfgErrConfigLocked            = -3294,                        /* Access conflict - retry later*/
  105.     kCfgErrEntityNotFound        = -3295,                        /* An entity with this name doesn't exist*/
  106.     kCfgErrEntityAlreadyExists    = -3296,                        /* An entity with this name already exists*/
  107.     kCfgErrPrefsTypeNotFound    = -3297,                        /* An record with this PrefsType doesn't exist*/
  108.     kCfgErrDataTruncated        = -3298,                        /* Data truncated when read buffer too small*/
  109.     kCfgErrFileCorrupted        = -3299                            /* The database format appears to be corrupted.*/
  110. };
  111.  
  112. /*    reserve a 'free' tag for free blocks*/
  113. enum {
  114.     kCfgTypefree                = FOUR_CHAR_CODE('free')
  115. };
  116.  
  117. /*    -------------------------------------------------------------------------
  118.     CfgEntityClass / CfgEntityType
  119.  
  120.     The database can distinguish between several classes of objects and 
  121.     several types withing each class
  122.     Use of different classes allow to store type of information in the same database
  123.  
  124.     Other entity classes and types can be defined by developers.
  125.     they should be unique and registered with Developer Tech Support (DTS)
  126.     ------------------------------------------------------------------------- */
  127. enum {
  128.     kCfgClassAnyEntity            = FOUR_CHAR_CODE('****'),
  129.     kCfgClassUnknownEntity        = FOUR_CHAR_CODE('????'),
  130.     kCfgTypeAnyEntity            = FOUR_CHAR_CODE('****'),
  131.     kCfgTypeUnknownEntity        = FOUR_CHAR_CODE('????')
  132. };
  133.  
  134. /*    -------------------------------------------------------------------------
  135.     For CfgIsSameEntityRef
  136.     ------------------------------------------------------------------------- */
  137. enum {
  138.     kCfgIgnoreArea                = true,
  139.     kCfgDontIgnoreArea            = false
  140. };
  141.  
  142. #endif    /* __NETWORKSETUPTYPES__ */
  143. /*******************************************************************************
  144. **    Configuration Information Access API 
  145. ********************************************************************************/
  146. /*    -------------------------------------------------------------------------
  147.     Database access
  148.     ------------------------------------------------------------------------- */
  149. EXTERN_API( OSStatus )
  150. OTCfgOpenDatabase                (CfgDatabaseRef *        dbRef);
  151.  
  152. /*
  153.     OTCfgOpenDatabase()
  154.  
  155.     Inputs:        none
  156.     Outputs:    CfgDatabaseRef* dbRef            Reference to opened database
  157.     Returns:    OSStatus                        *** list errors ***
  158.  
  159.     Opens the Configuration API for a given client. This call should be made prior to any other call.
  160. */
  161. EXTERN_API( OSStatus )
  162. OTCfgCloseDatabase                (CfgDatabaseRef *        dbRef);
  163.  
  164. /*
  165.     OTCfgCloseDatabase()
  166.  
  167.     Inputs:        CfgDatabaseRef* dbRef            Reference to opened database
  168.     Outputs:    CfgDatabaseRef* dbRef            Reference to opened database is cleared
  169.     Returns:    OSStatus                        *** list errors ***
  170.  
  171.     Closes the Configuration API for a given client. This call should be made when the client no 
  172.     longer wants to use the Configuration API.  
  173. */
  174. /*    -------------------------------------------------------------------------
  175.     Area management
  176.     ------------------------------------------------------------------------- */
  177. EXTERN_API( OSStatus )
  178. OTCfgGetAreasCount                (CfgDatabaseRef         dbRef,
  179.                                  ItemCount *            itemCount);
  180.  
  181. /*
  182.     OTCfgGetAreasCount()
  183.  
  184.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  185.     Outputs:    ItemCount* itemCount            Number of entities defined
  186.     Returns:    OSStatus                        *** list errors ***
  187.  
  188.     Returns the number of areas currently defined.
  189. */
  190. EXTERN_API( OSStatus )
  191. OTCfgGetAreasList                (CfgDatabaseRef         dbRef,
  192.                                  ItemCount *            itemCount,
  193.                                  CfgAreaID                 areaID[],
  194.                                  Str255                 areaName[]);
  195.  
  196. /*
  197.     OTCfgGetAreasList()
  198.  
  199.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  200.                 ItemCount* itemCount            Number of entities requested
  201.     Outputs:    ItemCount* itemCount            Number of entities defined
  202.     Returns:    OSStatus                        *** list errors ***
  203.  
  204.     Returns a list of area IDs and names. On entry, count should be set to whatever OTCfgGetAreasCount 
  205.     returned.  On exit, count contains the actual number of areas found. This can be less than the 
  206.     initial count value if areas were deleted in the meantime.  The id and name parameters are stored 
  207.     in arrays that should each be able to contain count values.
  208. */
  209. EXTERN_API( OSStatus )
  210. OTCfgGetCurrentArea                (CfgDatabaseRef         dbRef,
  211.                                  CfgAreaID *            areaID);
  212.  
  213. /*
  214.     OTCfgGetCurrentArea()
  215.  
  216.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  217.     Outputs:    CfgAreaID* areaID                ID of current area
  218.     Returns:    OSStatus                        *** list errors ***
  219.  
  220.     Returns the id of the current area.
  221. */
  222. EXTERN_API( OSStatus )
  223. OTCfgSetCurrentArea                (CfgDatabaseRef         dbRef,
  224.                                  CfgAreaID                 areaID);
  225.  
  226. /*
  227.     OTCfgSetCurrentArea()
  228.  
  229.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  230.                 CfgAreaID areaID                ID of area to make active
  231.     Outputs:    none
  232.     Returns:    OSStatus                        *** list errors ***
  233.  
  234.     Sets the current area. If the area doesn't exist kCfgErrAreaNotFound is returned.
  235. */
  236. EXTERN_API( OSStatus )
  237. OTCfgCreateArea                    (CfgDatabaseRef         dbRef,
  238.                                  ConstStr255Param         areaName,
  239.                                  CfgAreaID *            areaID);
  240.  
  241. /*
  242.     OTCfgCreateArea()
  243.  
  244.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  245.                 ConstStr255Param areaName        Name of area to create
  246.     Outputs:    CfgAreaID* areaID                ID of newly created area
  247.     Returns:    OSStatus                        *** list errors ***
  248.  
  249.     Creates a new area with the specified name. Then name must be unique or kCfgErrAreaAlreadyExists 
  250.     will be returned.
  251. */
  252. EXTERN_API( OSStatus )
  253. OTCfgDeleteArea                    (CfgDatabaseRef         dbRef,
  254.                                  CfgAreaID                 areaID);
  255.  
  256. /*
  257.     OTCfgDeleteArea()
  258.  
  259.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  260.                 CfgAreaID areaID                ID of area to delete
  261.     Outputs:    none
  262.     Returns:    OSStatus                        *** list errors ***
  263.  
  264.     Deletes the specified area. If the area doesn't exist kCfgErrAreaNotFound is returned.
  265. */
  266. EXTERN_API( OSStatus )
  267. OTCfgDuplicateArea                (CfgDatabaseRef         dbRef,
  268.                                  CfgAreaID                 sourceAreaID,
  269.                                  CfgAreaID                 destAreaID);
  270.  
  271. /*
  272.     OTCfgDuplicateArea()
  273.  
  274.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  275.                 CfgAreaID sourceAreaID            Area to duplicate
  276.                 CfgAreaID destAreaID            Area to contain duplicate
  277.     Outputs:    none
  278.     Returns:    OSStatus                        *** list errors ***
  279.  
  280.     Duplicates the source area content into the destination area. Both areas should exist prior to 
  281.     making this call. If either area doesn't exist kCfgErrAreaNotFound is returned.
  282. */
  283. EXTERN_API( OSStatus )
  284. OTCfgSetAreaName                (CfgDatabaseRef         dbRef,
  285.                                  CfgAreaID                 areaID,
  286.                                  ConstStr255Param         areaName,
  287.                                  CfgAreaID *            newAreaID);
  288.  
  289. /*
  290.     OTCfgSetAreaName()
  291.  
  292.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  293.                 CfgAreaID areaID                ID of area being named
  294.                 ConstStr255Param areaName        New name for area
  295.     Outputs:    CfgAreaID* newAreaID            ID of renamed area
  296.     Returns:    OSStatus                        *** list errors ***
  297.  
  298.     Renames the specified area. A new id is returned: it should be used from now on. If the area 
  299.     doesn't exist kCfgErrAreaNotFound is returned.
  300. */
  301. EXTERN_API( OSStatus )
  302. OTCfgGetAreaName                (CfgDatabaseRef         dbRef,
  303.                                  CfgAreaID                 areaID,
  304.                                  Str255                 areaName);
  305.  
  306. /*
  307.     OTCfgGetAreaName()
  308.  
  309.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  310.                 CfgAreaID areaID                ID of area being queried
  311.     Outputs:    Str255 areaName                    Name of area
  312.     Returns:    OSStatus                        *** list errors ***
  313.  
  314.     Gets the name of the specified area. If the area doesn't exist kCfgErrAreaNotFound is returned.
  315. */
  316. /*    -------------------------------------------------------------------------
  317.     Configuration Database API
  318.     
  319.     Single Writer ONLY!!!
  320.     ------------------------------------------------------------------------- */
  321. /*    -------------------------------------------------------------------------
  322.     Opening an area for reading
  323.     ------------------------------------------------------------------------- */
  324. EXTERN_API( OSStatus )
  325. OTCfgOpenArea                    (CfgDatabaseRef         dbRef,
  326.                                  CfgAreaID                 areaID);
  327.  
  328. /*
  329.     OTCfgOpenArea()
  330.  
  331.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  332.                 CfgAreaID areaID                ID of area to open
  333.     Outputs:    none
  334.     Returns:    OSStatus                        *** list errors ***
  335.  
  336.     Opens the specified area for reading. If the area doesn't exist kCfgErrAreaNotFound is returned.
  337. */
  338. EXTERN_API( OSStatus )
  339. OTCfgCloseArea                    (CfgDatabaseRef         dbRef,
  340.                                  CfgAreaID                 areaID);
  341.  
  342. /*
  343.     OTCfgCloseArea()
  344.  
  345.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  346.                 CfgAreaID areaID                ID of area to close
  347.     Outputs:    none
  348.     Returns:    OSStatus                        *** list errors ***
  349.  
  350.     Closes an area opened for reading. If the area doesn't exist kCfgErrAreaNotFound is returned.  
  351.     Opening an area for writing All modifications to an area should be performed as part of a 
  352.     transaction.
  353. */
  354. /*
  355.     For write access
  356. */
  357. EXTERN_API( OSStatus )
  358. OTCfgBeginAreaModifications        (CfgDatabaseRef         dbRef,
  359.                                  CfgAreaID                 readAreaID,
  360.                                  CfgAreaID *            writeAreaID);
  361.  
  362. /*
  363.     OTCfgBeginAreaModifications()
  364.  
  365.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  366.                 CfgAreaID readAreaID            ID of area opened for reading
  367.     Outputs:    CfgAreaID* writeAreaID            ID of area opened for modification
  368.     Returns:    OSStatus                        *** list errors ***
  369.  
  370.     Opens the specified area for writing. A new area id is provided.  This area id should be used to 
  371.     enumerate, add, delete, read and write to the modified data. The original id can still be used to 
  372.     access the original unmodified data. If the area doesn't exist kCfgErrAreaNotFound is returned.
  373. */
  374. EXTERN_API( OSStatus )
  375. OTCfgCommitAreaModifications    (CfgDatabaseRef         dbRef,
  376.                                  CfgAreaID                 readAreaID,
  377.                                  CfgAreaID                 writeAreaID);
  378.  
  379. /*
  380.     OTCfgCommitAreaModifications()
  381.  
  382.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  383.                 CfgAreaID readAreaID            ID of area opened for reading
  384.                 CfgAreaID writeAreaID            ID of area opened for modification
  385.     Outputs:    none
  386.     Returns:    OSStatus                        *** list errors ***
  387.  
  388.     Closes an area opened for writing.  All modifications are committed and readers are informed that 
  389.     the database changed state ( kCfgStateChangedErr ). The areaID should be the id of the original 
  390.     area.  If the area doesn't exist or the wrong id is passed, kCfgErrAreaNotFound is returned.
  391. */
  392. EXTERN_API( OSStatus )
  393. OTCfgAbortAreaModifications        (CfgDatabaseRef         dbRef,
  394.                                  CfgAreaID                 readAreaID);
  395.  
  396. /*
  397.     OTCfgAbortAreaModifications()
  398.  
  399.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  400.                 CfgAreaID readAreaID            ID of area opened for reading
  401.     Outputs:    none
  402.     Returns:    OSStatus                        *** list errors ***
  403.  
  404.     Closes an area opened for writing, discarding any modification. The areaID should be the id of 
  405.     the original area. If the area doesn't exist or the wrong id is passed kCfgErrAreaNotFound is 
  406.     returned.
  407. */
  408. /*
  409.     Working with entities
  410.  
  411.     Entities can be manipulated as soon as an area has been opened.  The same calls work both for 
  412.     areas opened for reading or for modification. In the latter case, the calls can be used on the 
  413.     original or new area id to access the original data or the modified data.
  414. */
  415. /*
  416.     For everybody
  417.     Count receives the actual number of entities
  418. */
  419. EXTERN_API( OSStatus )
  420. OTCfgGetEntitiesCount            (CfgDatabaseRef         dbRef,
  421.                                  CfgAreaID                 areaID,
  422.                                  CfgEntityClass         entityClass,
  423.                                  CfgEntityType             entityType,
  424.                                  ItemCount *            itemCount);
  425.  
  426. /*
  427.     OTCfgGetEntitiesCount()
  428.  
  429.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  430.                 CfgAreaID areaID                ID of area to count
  431.                 CfgEntityClass entityClass        Class of entities to count
  432.                 CfgEntityType entityType        Type of entities to count
  433.     Outputs:    ItemCount* itemCount            Count of matching entities
  434.     Returns:    OSStatus                        *** list errors ***
  435.  
  436.     Returns the number of entities of the specified class and type in the specified area. To obtain 
  437.     all entities regardless of their class or type pass kCfgClassAnyEntity or kCfgTypeAnyEntity. If 
  438.     the area doesn't exist or the wrong id is passed kCfgErrAreaNotFound is returned.
  439. */
  440.  
  441. /*
  442.     Count as input, is the number of entities to read;
  443.     count as output, receives the actual number of entities or the number you specified. 
  444. */
  445. EXTERN_API( OSStatus )
  446. OTCfgGetEntitiesList            (CfgDatabaseRef         dbRef,
  447.                                  CfgAreaID                 areaID,
  448.                                  CfgEntityClass         entityClass,
  449.                                  CfgEntityType             entityType,
  450.                                  ItemCount *            itemCount,
  451.                                  CfgEntityRef             entityRef[],
  452.                                  CfgEntityInfo             entityInfo[]);
  453.  
  454. /*
  455.     OTCfgGetEntitiesList()
  456.  
  457.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  458.                 CfgAreaID areaID                ID of area to list
  459.                 CfgEntityClass entityClass        Class of entities to list
  460.                 CfgEntityType entityType        Type of entities to list
  461.                 ItemCount* itemCount            Count of entities requested
  462.     Outputs:    ItemCount* itemCount            Count of entities listed
  463.     Returns:    OSStatus                        *** list errors ***
  464.  
  465.     Returns the list of entities of the specified class and type in the specified area. To obtain all 
  466.     entities regardless of their class or type pass kCfgClassAnyEntity or kCfgTypeAnyEntity. The 
  467.     count parameter should have the value obtained by CfgGetEntitiesCount.  On exit count may be less 
  468.     if some entities were deleted in the meantime. The id and info parameters should be arrays large 
  469.     enough to hold count entries. If the area doesn't exist or the wrong id is passed 
  470.     kCfgErrAreaNotFound is returned.  The info array contains information about each entity, 
  471.     including its class, type, name and the area of its icon:
  472.  
  473.     struct CfgEntityInfo
  474.     {
  475.         CfgEntityClass        fClass;
  476.         CfgEntityType        fType;
  477.         ConstStr255Param    fName;
  478.         CfgResourceLocator    fIcon;
  479.     };
  480. */
  481. EXTERN_API( OSStatus )
  482. OTCfgCreateEntity                (CfgDatabaseRef         dbRef,
  483.                                  CfgAreaID                 areaID,
  484.                                  const CfgEntityInfo *    entityInfo,
  485.                                  CfgEntityRef *            entityRef);
  486.  
  487. /*
  488.     OTCfgCreateEntity()
  489.  
  490.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  491.                 CfgAreaID areaID                ID of area to contain entity
  492.                 CfgEntityInfo* entityInfo        Information that defines the entity
  493.     Outputs:    CfgEntityRef* entityRef            Reference to entity created
  494.     Returns:    OSStatus                        *** list errors ***
  495.  
  496.     Creates a new entity with the specified class, type and name and returns an id for it. If the 
  497.     area doesn't exist or the wrong id is passed kCfgErrAreaNotFound is returned. If there is already 
  498.     an entity with the same name kCfgErrEntityAlreadyExists is returned.
  499. */
  500. EXTERN_API( OSStatus )
  501. OTCfgDeleteEntity                (CfgDatabaseRef         dbRef,
  502.                                  const CfgEntityRef *    entityRef);
  503.  
  504. /*
  505.     OTCfgDeleteEntity()
  506.  
  507.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  508.                 CfgEntityRef* entityRef            Reference to entity to delete
  509.     Outputs:    none
  510.     Returns:    OSStatus                        *** list errors ***
  511.  
  512.     Deletes the specified entity. If there is no entity with this id kCfgEntityNotfoundErr is returned
  513. */
  514. EXTERN_API( OSStatus )
  515. OTCfgDuplicateEntity            (CfgDatabaseRef         dbRef,
  516.                                  const CfgEntityRef *    entityRef,
  517.                                  const CfgEntityRef *    newEntityRef);
  518.  
  519. /*
  520.     OTCfgDuplicateEntity()
  521.  
  522.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  523.                 CfgEntityRef* entityRef            Reference to entity to duplicate
  524.     Outputs:    CfgEntityRef* newEntityRef        Reference to duplicate entity
  525.     Returns:    OSStatus                        *** list errors ***
  526.  
  527.     Duplicates the specified entity. Both entities should exit. If any entity doesn't exist 
  528.     kCfgErrEntityNotFound is returned.
  529. */
  530. EXTERN_API( OSStatus )
  531. OTCfgSetEntityName                (CfgDatabaseRef         dbRef,
  532.                                  const CfgEntityRef *    entityRef,
  533.                                  ConstStr255Param         entityName,
  534.                                  CfgEntityRef *            newEntityRef);
  535.  
  536. /*
  537.     OTCfgSetEntityName()
  538.  
  539.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  540.                 CfgEntityRef* entityRef            Reference to entity to duplicate
  541.                 ConstStr255Param entityName        New name for entity
  542.     Outputs:    CfgEntityRef* newEntityRef        Reference to renamed entity
  543.     Returns:    OSStatus                        *** list errors ***
  544.  
  545.     Renames the specified entity. If the entity doesn't exist kCfgEntityNotfoundErr is returned. If 
  546.     there is already an entity with that name kCfgErrEntityAlreadyExists is returned.
  547. */
  548. EXTERN_API( void )
  549. OTCfgGetEntityArea                (const CfgEntityRef *    entityRef,
  550.                                  CfgAreaID *            areaID);
  551.  
  552. /*
  553.     OTCfgGetEntityArea()
  554.  
  555.     Inputs:        CfgEntityRef *entityRef            Reference to an entity
  556.     Outputs:    CfgAreaID *areaID                ID of area that contains the entity
  557.     Returns:    none
  558.  
  559.     Returns the area ID associated with the specified entity reference.
  560. */
  561. EXTERN_API( void )
  562. OTCfgGetEntityName                (const CfgEntityRef *    entityRef,
  563.                                  Str255                 entityName);
  564.  
  565. /*
  566.     OTCfgGetEntityName()
  567.  
  568.     Inputs:        CfgEntityRef *entityRef            Reference to an entity
  569.     Outputs:    Str255 entityName                Name of the entity
  570.     Returns:    none
  571.  
  572.     Returns the entity name associated with the specified entity reference.
  573. */
  574. EXTERN_API( void )
  575. OTCfgChangeEntityArea            (CfgEntityRef *            entityRef,
  576.                                  CfgAreaID                 newAreaID);
  577.  
  578. /*
  579.     OTCfgChangeEntityArea()
  580.  
  581.     Inputs:        CfgEntityRef *entityRef            Reference to an entity
  582.                 CfgAreaID newAreaID                ID of area to contain moved entity
  583.     Outputs:    none
  584.     Returns:    none
  585.  
  586.     Changes the area ID associated with the specified entity reference. This effectively moves the 
  587.     entity to a different area.
  588. */
  589. /*    -------------------------------------------------------------------------
  590.     These API calls are for the protocol developers to compare the IDs.
  591.     ------------------------------------------------------------------------- */
  592. /*    -------------------------------------------------------------------------
  593.     For OTCfgIsSameEntityRef
  594.     ------------------------------------------------------------------------- */
  595. enum {
  596.     kOTCfgIgnoreArea            = kCfgIgnoreArea,
  597.     kOTCfgDontIgnoreArea        = kCfgDontIgnoreArea
  598. };
  599.  
  600. EXTERN_API( Boolean )
  601. OTCfgIsSameEntityRef            (const CfgEntityRef *    entityRef1,
  602.                                  const CfgEntityRef *    entityRef2,
  603.                                  Boolean                 ignoreArea);
  604.  
  605. /*
  606.     OTCfgIsSameEntityRef()
  607.  
  608.     Inputs:        CfgEntityRef* entityRef1        Reference to an entity
  609.                 CfgEntityRef* entityRef2        Reference to another entity
  610.                 Boolean ignoreArea                If true, ignore the area ID
  611.     Outputs:    none
  612.     Returns:    Boolean                            If true, entity references match
  613.  
  614.     Compare two entity references. If ignoreArea is true, and the two entity names are the same, then return 
  615.     true. If ignoreArea is false, then the area IDs must be the same, as well as the entity names 
  616.     must be the same, then can return true.
  617. */
  618. EXTERN_API( Boolean )
  619. OTCfgIsSameAreaID                (CfgAreaID                 areaID1,
  620.                                  CfgAreaID                 areaID2);
  621.  
  622. /*
  623.     OTCfgIsSameAreaID()
  624.  
  625.     Inputs:        CfgAreaID areaID1                ID of an area
  626.                 CfgAreaID areaID2                ID of another area
  627.     Outputs:    none
  628.     Returns:    Boolean                            If true, area IDs match
  629.  
  630.     Compare two area IDs. Return true for matching area IDs, and return false for the different area IDs.
  631. */
  632. /*    -------------------------------------------------------------------------
  633.     Dealing with individual preferences
  634.     ------------------------------------------------------------------------- */
  635. /*    -------------------------------------------------------------------------
  636.     Open Preferences
  637.     if writer = true, GetPrefs and SetPrefs are allowed, else only GetPrefs is allowed.
  638.     ------------------------------------------------------------------------- */
  639. EXTERN_API( OSStatus )
  640. OTCfgOpenPrefs                    (CfgDatabaseRef         dbRef,
  641.                                  const CfgEntityRef *    entityRef,
  642.                                  Boolean                 writer,
  643.                                  CfgEntityAccessID *    accessID);
  644.  
  645. /*
  646.     OTCfgOpenPrefs()
  647.  
  648.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  649.                 CfgEntityRef* entityRef            Reference to an entity
  650.                 Boolean writer                If true, open for write
  651.     Outputs:    CfgEntityAccessID* accessID        ID for entity access
  652.     Returns:    OSStatus                        *** list errors ***
  653.  
  654.     Open the specified entity and return the CfgEntityAccessID for the following access of the 
  655.     content of the entity. If writer is true, CfgGetPrefs and CfgSetPrefs are allowed, otherwise only 
  656.     CfgGetPrefs is allowed.
  657. */
  658. EXTERN_API( OSStatus )
  659. OTCfgClosePrefs                    (CfgEntityAccessID         accessID);
  660.  
  661. /*
  662.     OTCfgClosePrefs()
  663.  
  664.     Inputs:        CfgEntityAccessID* accessID        ID for entity to close
  665.     Outputs:    none
  666.     Returns:    OSStatus                        *** list errors ***
  667.  
  668.     Close the entity with the specified CfgEntityAccessID.
  669. */
  670. /*    -------------------------------------------------------------------------
  671.     Get/Set Preferences
  672.  
  673.     Accessing the content of an entity
  674.  
  675.     These API calls are for the protocol developers. It supports multiple records per entity. Each 
  676.     record is identified by the prefsType and the size of the record. The protocol stack will provide 
  677.     the STRUCT to view the content of each record.
  678.     ------------------------------------------------------------------------- */
  679. EXTERN_API( OSStatus )
  680. OTCfgSetPrefs                    (CfgEntityAccessID         accessID,
  681.                                  OSType                 prefsType,
  682.                                  const void *            data,
  683.                                  ByteCount                 length);
  684.  
  685. /*
  686.     OTCfgSetPrefs()
  687.  
  688.     Inputs:        CfgEntityAccessID* accessID        ID of entity to access
  689.                 OSType prefsType                Record type to set
  690.                 void* data                        Address of data
  691.                 ByteCount length                Number of bytes of data
  692.     Outputs:    none
  693.     Returns:    OSStatus                        *** list errors ***
  694.  
  695.     Write the data to the specified record. The record is identified by the prefsType. If the entity 
  696.     is not opened for the writer, an error code is returned.
  697. */
  698. EXTERN_API( OSStatus )
  699. OTCfgGetPrefs                    (CfgEntityAccessID         accessID,
  700.                                  OSType                 prefsType,
  701.                                  void *                    data,
  702.                                  ByteCount                 length);
  703.  
  704. /*
  705.     OTCfgGetPrefs()
  706.  
  707.     Inputs:        CfgEntityAccessID* accessID        ID of entity to access
  708.                 OSType prefsType                Record type to get
  709.                 void* data                        Address for data
  710.                 ByteCount length                Number of bytes of data requested
  711.     Outputs:    none
  712.     Returns:    OSStatus                        *** list errors ***
  713.  
  714.     Read the data from the specified record to the passed buffer. The record is identified by the 
  715.     prefsType. If the passed buffer is too small, kCfgErrDataTruncated is returned, but will copy as 
  716.     many data as possible to the buffer.
  717. */
  718. EXTERN_API( OSStatus )
  719. OTCfgGetPrefsSize                (CfgEntityAccessID         accessID,
  720.                                  OSType                 prefsType,
  721.                                  ByteCount *            length);
  722.  
  723. /*
  724.     OTCfgGetPrefsSize()
  725.  
  726.     Inputs:        CfgEntityAccessID* accessID        ID of entity to access
  727.                 OSType prefsType                Record type to get
  728.                 ByteCount length                Number of bytes of data available
  729.     Outputs:    none
  730.     Returns:    OSStatus                        *** list errors ***
  731.  
  732.     Returns the length, in bytes, of the specified record. The record is identified by the prefsType.
  733. */
  734. /*    -------------------------------------------------------------------------
  735.     Get table of contents for prefs
  736.     ------------------------------------------------------------------------- */
  737. EXTERN_API( OSStatus )
  738. OTCfgGetPrefsTOCCount            (CfgEntityAccessID         accessID,
  739.                                  ItemCount *            itemCount);
  740.  
  741. /*
  742.     OTCfgGetPrefsTOCCount()
  743.  
  744.     Inputs:        CfgEntityAccessID* accessID        ID of entity to access
  745.     Outputs:    ItemCount* itemCount            Number of entries available
  746.     Returns:    OSStatus                        *** list errors ***
  747.  
  748.     Get the count of all the record headers in the entity. Return the number of records in the count. 
  749. */
  750. EXTERN_API( OSStatus )
  751. OTCfgGetPrefsTOC                (CfgEntityAccessID         accessID,
  752.                                  ItemCount *            itemCount,
  753.                                  CfgPrefsHeader         PrefsTOC[]);
  754.  
  755. /*
  756.     OTCfgGetPrefsTOC()
  757.  
  758.     Inputs:        CfgEntityAccessID* accessID        ID of entity to access
  759.                 ItemCount* itemCount            Number of entries requested
  760.     Outputs:    ItemCount* itemCount            Number of entries available
  761.                 CfgPrefsHeader PrefsTOC[]        Table of entries
  762.     Returns:    OSStatus                        *** list errors ***
  763.  
  764.     Get the list of all the record headers in the entity. Return the number of records in the count. 
  765.     If the PrefsTOC is specified, it has to be big enough to hold all the record headers. If the 
  766.     PrefsTOC is null, only the count is returned.
  767. */
  768. EXTERN_API( SInt16 )
  769. OTCfgEncrypt                    (UInt8 *                key,
  770.                                  UInt8 *                data,
  771.                                  SInt16                 dataLen);
  772.  
  773. /*
  774.     OTCfgEncrypt()
  775.  
  776.     Inputs:        UInt8 *key                        encryption key ( user name )
  777.                 UInt8 *data                        data to encrypt ( password )
  778.                 SInt16 dataLen                    length of data to encrypt
  779.     Outputs:    UInt8 *data                        encrypted data
  780.     Returns:    SInt16                            length of encrypted data
  781.  
  782.     Encrypt the password, using the user name as the encryption key.  Return the encrypted password and its length.  
  783. */
  784. EXTERN_API( SInt16 )
  785. OTCfgDecrypt                    (UInt8 *                key,
  786.                                  UInt8 *                data,
  787.                                  SInt16                 dataLen);
  788.  
  789. /*
  790.     OTCfgDecrypt()
  791.  
  792.     Inputs:        UInt8 *key                        encryption key ( user name )
  793.                 UInt8 *data                        data to decrypt ( password )
  794.                 SInt16 dataLen                    length of data to decrypt
  795.     Outputs:    UInt8 *data                        decrypted data
  796.     Returns:    SInt16                            length of decrypted data
  797.  
  798.     Decrypt the password, using the user name as the encryption key.  Return the decrypted password and its length.  
  799. */
  800. EXTERN_API( Handle )
  801. OTCfgGetDefault                    (ResType                 entityType,
  802.                                  ResType                 entityClass,
  803.                                  ResType                 recordType);
  804.  
  805. EXTERN_API( OSStatus )
  806. OTCfgInstallNotifier            (CfgDatabaseRef         dbRef,
  807.                                  CfgEntityClass         theClass,
  808.                                  CfgEntityType             theType,
  809.                                  OTNotifyProcPtr         notifier,
  810.                                  void *                    contextPtr);
  811.  
  812. EXTERN_API( OSStatus )
  813. OTCfgRemoveNotifier                (CfgDatabaseRef         dbRef,
  814.                                  CfgEntityClass         theClass,
  815.                                  CfgEntityType             theType);
  816.  
  817.  
  818. typedef UInt16                             OTCfgIRPortSetting;
  819. enum {
  820.     kOTCfgTypeStruct            = FOUR_CHAR_CODE('stru'),
  821.     kOTCfgTypeElement            = FOUR_CHAR_CODE('elem'),
  822.     kOTCfgTypeVector            = FOUR_CHAR_CODE('vect')
  823. };
  824.  
  825. /*    -------------------------------------------------------------------------
  826.     CfgEntityClass / CfgEntityType
  827.  
  828.     The database can distinguish between several classes of objects and 
  829.     several types withing each class
  830.     Use of different classes allow to store type of information in the same database
  831.  
  832.     Other entity classes and types can be defined by developers.
  833.     they should be unique and registered with Developer Tech Support (DTS)
  834.     ------------------------------------------------------------------------- */
  835. enum {
  836.     kOTCfgClassNetworkConnection = FOUR_CHAR_CODE('otnc'),
  837.     kOTCfgClassGlobalSettings    = FOUR_CHAR_CODE('otgl'),
  838.     kOTCfgClassServer            = FOUR_CHAR_CODE('otsv'),
  839.     kOTCfgTypeGeneric            = FOUR_CHAR_CODE('otan'),
  840.     kOTCfgTypeAppleTalk            = FOUR_CHAR_CODE('atlk'),
  841.     kOTCfgTypeTCPv4                = FOUR_CHAR_CODE('tcp4'),
  842.     kOTCfgTypeTCPv6                = FOUR_CHAR_CODE('tcp6'),
  843.     kOTCfgTypeRemote            = FOUR_CHAR_CODE('ara '),
  844.     kOTCfgTypeDial                = FOUR_CHAR_CODE('dial'),
  845.     kOTCfgTypeModem                = FOUR_CHAR_CODE('modm'),
  846.     kOTCfgTypeInfrared            = FOUR_CHAR_CODE('infr'),
  847.     kOTCfgClassSetOfSettings    = FOUR_CHAR_CODE('otsc'),
  848.     kOTCfgTypeSetOfSettings        = FOUR_CHAR_CODE('otst'),
  849.     kOTCfgTypeDNS                = FOUR_CHAR_CODE('dns ')
  850. };
  851.  
  852. /*******************************************************************************
  853. ** Preferences Structures
  854. ********************************************************************************/
  855. enum {
  856.     kOTCfgIndexSetsActive        = 0,
  857.     kOTCfgIndexSetsEdit            = 1,
  858.     kOTCfgIndexSetsLimit        = 2                                /*    last value, no comma*/
  859. };
  860.  
  861.  
  862. struct CfgSetsStruct {
  863.     UInt32                             fFlags;
  864.     UInt32                             fTimes[2];
  865. };
  866. typedef struct CfgSetsStruct            CfgSetsStruct;
  867.  
  868. struct CfgSetsElement {
  869.     CfgEntityRef                     fEntityRef;
  870.     CfgEntityInfo                     fEntityInfo;
  871. };
  872. typedef struct CfgSetsElement            CfgSetsElement;
  873.  
  874. struct CfgSetsVector {
  875.     UInt32                             fCount;
  876.     CfgSetsElement                     fElements[1];
  877. };
  878. typedef struct CfgSetsVector            CfgSetsVector;
  879. /*    Common    */
  880. enum {
  881.                                                                 /*    connection    */
  882.     kOTCfgTypeConfigName        = FOUR_CHAR_CODE('cnam'),
  883.     kOTCfgTypeConfigSelected    = FOUR_CHAR_CODE('ccfg'),        /*    transport options    */
  884.     kOTCfgTypeUserLevel            = FOUR_CHAR_CODE('ulvl'),
  885.     kOTCfgTypeWindowPosition    = FOUR_CHAR_CODE('wpos')
  886. };
  887.  
  888. /*    AppleTalk    */
  889. enum {
  890.                                                                 /*    connection    */
  891.     kOTCfgTypeAppleTalkPrefs    = FOUR_CHAR_CODE('atpf'),
  892.     kOTCfgTypeAppleTalkVersion    = FOUR_CHAR_CODE('cvrs'),
  893.     kOTCfgTypeAppleTalkLocks    = FOUR_CHAR_CODE('lcks'),
  894.     kOTCfgTypeAppleTalkPort        = FOUR_CHAR_CODE('port'),
  895.     kOTCfgTypeAppleTalkProtocol    = FOUR_CHAR_CODE('prot'),
  896.     kOTCfgTypeAppleTalkPassword    = FOUR_CHAR_CODE('pwrd'),
  897.     kOTCfgTypeAppleTalkPortFamily = FOUR_CHAR_CODE('ptfm')        /*    transport options    */
  898. };
  899.  
  900. enum {
  901.     kOTCfgIndexAppleTalkAARP    = 0,
  902.     kOTCfgIndexAppleTalkDDP        = 1,
  903.     kOTCfgIndexAppleTalkNBP        = 2,
  904.     kOTCfgIndexAppleTalkZIP        = 3,
  905.     kOTCfgIndexAppleTalkATP        = 4,
  906.     kOTCfgIndexAppleTalkADSP    = 5,
  907.     kOTCfgIndexAppleTalkPAP        = 6,
  908.     kOTCfgIndexAppleTalkASP        = 7,
  909.     kOTCfgIndexAppleTalkLast    = 7
  910. };
  911.  
  912.  
  913. struct OTCfgAppleTalkPrefs {
  914.     UInt16                             fVersion;
  915.     UInt16                             fNumPrefs;
  916.     OTPortRef                         fPort;
  917.     void *                            fLink;
  918.     void *                            fPrefs[8];
  919. };
  920. typedef struct OTCfgAppleTalkPrefs        OTCfgAppleTalkPrefs;
  921.  
  922. struct OTCfgAARPPrefs {
  923.     UInt16                             fVersion;
  924.     UInt16                             fSize;
  925.     UInt32                             fAgingCount;
  926.     UInt32                             fAgingInterval;
  927.     OTByteCount                     fProtAddrLen;
  928.     OTByteCount                     fHWAddrLen;
  929.     UInt32                             fMaxEntries;
  930.     OTByteCount                     fProbeInterval;
  931.     OTByteCount                     fProbeRetryCount;
  932.     OTByteCount                     fRequestInterval;
  933.     OTByteCount                     fRequestRetryCount;
  934. };
  935. typedef struct OTCfgAARPPrefs            OTCfgAARPPrefs;
  936.  
  937. struct OTCfgDDPPrefs {
  938.     UInt16                             fVersion;
  939.     UInt16                             fSize;
  940.     UInt32                             fTSDUSize;
  941.     UInt8                             fLoadType;
  942.     UInt8                             fNode;
  943.     UInt16                             fNetwork;
  944.     UInt16                             fRTMPRequestLimit;
  945.     UInt16                             fRTMPRequestInterval;
  946.     UInt32                             fAddressGenLimit;
  947.     UInt32                             fBRCAgingInterval;
  948.     UInt32                             fRTMPAgingInterval;
  949.     UInt32                             fMaxAddrTries;
  950.     Boolean                         fDefaultChecksum;
  951.     Boolean                         fIsFixedNode;
  952.     UInt8                             fMyZone[33];
  953. };
  954. typedef struct OTCfgDDPPrefs            OTCfgDDPPrefs;
  955.  
  956. struct OTCfgATPFPrefs {
  957.     OTCfgAppleTalkPrefs             fAT;
  958.     OTCfgAARPPrefs                     fAARP;
  959.     OTCfgDDPPrefs                     fDDP;
  960.     char                             fFill[122];
  961. };
  962. typedef struct OTCfgATPFPrefs            OTCfgATPFPrefs;
  963. /*    Infrared    */
  964. enum {
  965.     kOTCfgTypeInfraredPrefs        = FOUR_CHAR_CODE('atpf'),
  966.     kOTCfgTypeInfraredGlobal    = FOUR_CHAR_CODE('irgo')
  967. };
  968.  
  969.  
  970. struct OTCfgIRPrefs {
  971.     CfgPrefsHeader                     fHdr;
  972.     OTPortRef                         fPort;                        /*    OT port id*/
  973.     OTCfgIRPortSetting                 fPortSetting;                /*    Ir protocol,  irda or irtalk*/
  974.     Boolean                         fNotifyOnDisconnect;        /*    notify user on irda disconnect?*/
  975.     Boolean                         fDisplayIRControlStrip;        /*    show ir control strip?*/
  976.     Point                             fWindowPosition;            /*    The position of the editor window*/
  977. };
  978. typedef struct OTCfgIRPrefs                OTCfgIRPrefs;
  979.  
  980. struct OTCfgIRGlobal {
  981.     CfgPrefsHeader                     fHdr;                        /* standard prefererences header*/
  982.     UInt32                             fOptions;                    /* options bitmask*/
  983.     UInt32                             fNotifyMask;                /* Notification options.*/
  984.     UInt32                             fUnloadTimeout;                /* Unload timeout (in milliseconds)*/
  985. };
  986. typedef struct OTCfgIRGlobal            OTCfgIRGlobal;
  987. /*    TCP/IP v4    */
  988. enum {
  989.                                                                 /*    connection    */
  990.     kOTCfgTypeTCPalis            = FOUR_CHAR_CODE('alis'),
  991.     kOTCfgTypeTCPcvrs            = FOUR_CHAR_CODE('cvrs'),
  992.     kOTCfgTypeTCPdcid            = FOUR_CHAR_CODE('dcid'),
  993.     kOTCfgTypeTCPdclt            = FOUR_CHAR_CODE('dclt'),
  994.     kOTCfgTypeTCPdtyp            = FOUR_CHAR_CODE('dtyp'),
  995.     kOTCfgTypeTCPidns            = FOUR_CHAR_CODE('idns'),
  996.     kOTCfgTypeTCPihst            = FOUR_CHAR_CODE('ihst'),
  997.     kOTCfgTypeTCPiitf            = FOUR_CHAR_CODE('iitf'),
  998.     kOTCfgTypeTCPara            = FOUR_CHAR_CODE('ipcp'),
  999.     kOTCfgTypeTCPirte            = FOUR_CHAR_CODE('irte'),
  1000.     kOTCfgTypeTCPisdm            = FOUR_CHAR_CODE('isdm'),
  1001.     kOTCfgTypeTCPstng            = FOUR_CHAR_CODE('stng'),
  1002.     kOTCfgTypeTCPunld            = FOUR_CHAR_CODE('unld'),
  1003.     kOTCfgTypeTCPVersion        = FOUR_CHAR_CODE('cvrs'),        /*    Version */
  1004.     kOTCfgTypeTCPDevType        = FOUR_CHAR_CODE('dvty'),
  1005.     kOTCfgTypeTCPPrefs            = FOUR_CHAR_CODE('iitf'),
  1006.     kOTCfgTypeTCPServersList    = FOUR_CHAR_CODE('idns'),
  1007.     kOTCfgTypeTCPSearchList        = FOUR_CHAR_CODE('ihst'),
  1008.     kOTCfgTypeTCPRoutersList    = FOUR_CHAR_CODE('irte'),
  1009.     kOTCfgTypeTCPDomainsList    = FOUR_CHAR_CODE('isdm'),
  1010.     kOTCfgTypeTCPPort            = FOUR_CHAR_CODE('port'),        /*    Ports */
  1011.     kOTCfgTypeTCPProtocol        = FOUR_CHAR_CODE('prot'),
  1012.     kOTCfgTypeTCPPassword        = FOUR_CHAR_CODE('pwrd'),        /*    Password */
  1013.     kOTCfgTypeTCPLocks            = FOUR_CHAR_CODE('stng'),        /*    locks */
  1014.     kOTCfgTypeTCPUnloadType        = FOUR_CHAR_CODE('unld')        /*    transport options    */
  1015. };
  1016.  
  1017.  
  1018.  
  1019. struct OTCfgIDNSPrefs {
  1020.     short                             fCount;
  1021.     InetHost                         fAddressesList;
  1022. };
  1023. typedef struct OTCfgIDNSPrefs            OTCfgIDNSPrefs;
  1024.  
  1025. struct OTCfgHSTFPrefs {
  1026.     char                             fPrimaryInterfaceIndex;        /*    always 1 in OT 1.0 / 1.1*/
  1027.                                                                 /*    this structure IS packed!*/
  1028.     UInt8                             fLocalDomainName[256];
  1029.                                                                 /*    followed by */
  1030.     UInt8                             admindomain[256];
  1031. };
  1032. typedef struct OTCfgHSTFPrefs            OTCfgHSTFPrefs;
  1033. /*    This is your worst case, a fixed size structure, tacked on after a variable length string.*/
  1034. /*    Use the macro to help access the movable beast. */
  1035.  
  1036. #define    kIITFPartP( h ) ( (OTCfgIITFPrefsPart*) &( (**( (OTCfgIITFPrefs**) h )).fAppleTalkZone[ (**( (OTCfgIITFPrefs**) h )).fAppleTalkZone[0] + 1 ] ) )
  1037.  
  1038. /*
  1039.       This structure also contains an IP address and subnet mask that are not aligned on a four byte boundary.  
  1040.       In order to avoid compiler warnings, and the possibility of code that won't work, 
  1041.       these fields are defined here as four character arrays.  
  1042.       It is suggested that BlockMoveData be used to copy to and from a field of type InetHost.  
  1043. */
  1044.  
  1045. struct OTCfgIITFPrefsPart {
  1046.     char                             path[36];
  1047.     char                             module[32];
  1048.     unsigned long                     framing;
  1049. };
  1050. typedef struct OTCfgIITFPrefsPart        OTCfgIITFPrefsPart;
  1051.  
  1052. struct OTCfgIITFPrefs {
  1053.     short                             fCount;
  1054.     UInt8                             fConfigMethod;
  1055.                                                                 /*    this structure IS packed!*/
  1056.                                                                 /*    Followed by:*/
  1057.     UInt8                             fIPAddress[4];
  1058.     UInt8                             fSubnetMask[4];
  1059.     UInt8                             fAppleTalkZone[256];
  1060.                                                                 /*    this structure IS packed!*/
  1061.     UInt8                             fFiller;
  1062.     OTCfgIITFPrefsPart                 part;
  1063. };
  1064. typedef struct OTCfgIITFPrefs            OTCfgIITFPrefs;
  1065.  
  1066. struct OTCfgIRTEEntry {
  1067.     InetHost                         fToHost;                    /*    always 0;*/
  1068.     InetHost                         fViaHost;                    /*    router address;*/
  1069.     short                             fLocal;                        /*    always 0*/
  1070.     short                             fHost;                        /*    always 0*/
  1071. };
  1072. typedef struct OTCfgIRTEEntry            OTCfgIRTEEntry;
  1073.  
  1074. struct OTCfgIRTEPrefs {
  1075.     short                             fCount;
  1076.     OTCfgIRTEEntry                     fList[1];
  1077. };
  1078. typedef struct OTCfgIRTEPrefs            OTCfgIRTEPrefs;
  1079.  
  1080. struct OTCfgISDMPrefs {
  1081.     short                             fCount;
  1082.     Str255                             fDomainsList;
  1083. };
  1084. typedef struct OTCfgISDMPrefs            OTCfgISDMPrefs;
  1085.  
  1086. struct OTCfgDHCPRecord {
  1087.     InetHost                         ipIPAddr;
  1088.     InetHost                         ipConfigServer;
  1089.     UInt32                             ipLeaseGrantTime;
  1090.     UInt32                             ipLeaseExpirationTime;
  1091. };
  1092. typedef struct OTCfgDHCPRecord            OTCfgDHCPRecord;
  1093. /*    DNS    */
  1094. enum {
  1095.                                                                 /*    connection    */
  1096.     kOTCfgTypeDNSidns            = FOUR_CHAR_CODE('idns'),
  1097.     kOTCfgTypeDNSisdm            = FOUR_CHAR_CODE('isdm'),
  1098.     kOTCfgTypeDNSihst            = FOUR_CHAR_CODE('ihst'),
  1099.     kOTCfgTypeDNSstng            = FOUR_CHAR_CODE('stng'),
  1100.     kOTCfgTypeDNSPassword        = FOUR_CHAR_CODE('pwrd')        /*    transport options    */
  1101. };
  1102.  
  1103. /*    Modem    */
  1104. enum {
  1105.                                                                 /*    connection    */
  1106.     kOTCfgTypeModemModem        = FOUR_CHAR_CODE('ccl '),        /*    Type for Modem configuration resource*/
  1107.     kOTCfgTypeModemLocks        = FOUR_CHAR_CODE('lkmd'),        /*    Types for lock resources*/
  1108.     kOTCfgTypeModemAdminPswd    = FOUR_CHAR_CODE('mdpw'),        /*    Password*/
  1109.                                                                 /*    transport options    */
  1110.     kOTCfgTypeModemApp            = FOUR_CHAR_CODE('mapt')
  1111. };
  1112.  
  1113.  
  1114. struct OTCfgRemoteConfigModem {
  1115.     UInt32                             version;
  1116.     Boolean                         useModemScript;
  1117.     char                             pad00;                        /*    this structure is NOT packed!*/
  1118.     FSSpec                             modemScript;
  1119.     Boolean                         modemSpeakerOn;
  1120.     Boolean                         modemPulseDial;
  1121.     UInt32                             modemDialToneMode;
  1122.     SInt8                             lowerLayerName[36];
  1123. };
  1124. typedef struct OTCfgRemoteConfigModem    OTCfgRemoteConfigModem;
  1125.  
  1126. struct OTCfgModemLocks {
  1127.     UInt32                             version;
  1128.     UInt32                             port;
  1129.     UInt32                             script;
  1130.     UInt32                             speaker;
  1131.     UInt32                             dialing;
  1132. };
  1133. typedef struct OTCfgModemLocks            OTCfgModemLocks;
  1134.  
  1135. struct OTCfgModemAppPrefs {
  1136.     UInt32                             version;
  1137.     Point                             windowPos;
  1138.     SInt32                             userMode;
  1139. };
  1140. typedef struct OTCfgModemAppPrefs        OTCfgModemAppPrefs;
  1141. /*    Remote Access    */
  1142. enum {
  1143.                                                                 /*    connection    */
  1144.     kOTCfgTypeRemoteARAP        = FOUR_CHAR_CODE('arap'),
  1145.     kOTCfgTypeRemoteAddress        = FOUR_CHAR_CODE('cadr'),
  1146.     kOTCfgTypeRemoteChat        = FOUR_CHAR_CODE('ccha'),
  1147.     kOTCfgTypeRemoteDialing        = FOUR_CHAR_CODE('cdia'),
  1148.     kOTCfgTypeRemoteExtAddress    = FOUR_CHAR_CODE('cead'),
  1149.     kOTCfgTypeRemoteClientLocks    = FOUR_CHAR_CODE('clks'),
  1150.     kOTCfgTypeRemoteClientMisc    = FOUR_CHAR_CODE('cmsc'),
  1151.     kOTCfgTypeRemoteConnect        = FOUR_CHAR_CODE('conn'),
  1152.     kOTCfgTypeRemoteUser        = FOUR_CHAR_CODE('cusr'),
  1153.     kOTCfgTypeRemoteDialAssist    = FOUR_CHAR_CODE('dass'),
  1154.     kOTCfgTypeRemoteIPCP        = FOUR_CHAR_CODE('ipcp'),
  1155.     kOTCfgTypeRemoteLCP            = FOUR_CHAR_CODE('lcp '),        /* trailing space is important! */
  1156.     kOTCfgTypeRemoteLogOptions    = FOUR_CHAR_CODE('logo'),
  1157.     kOTCfgTypeRemotePassword    = FOUR_CHAR_CODE('pass'),
  1158.     kOTCfgTypeRemotePort        = FOUR_CHAR_CODE('port'),
  1159.     kOTCfgTypeRemoteServerLocks    = FOUR_CHAR_CODE('slks'),
  1160.     kOTCfgTypeRemoteServer        = FOUR_CHAR_CODE('srvr'),
  1161.     kOTCfgTypeRemoteUserMode    = FOUR_CHAR_CODE('usmd'),
  1162.     kOTCfgTypeRemoteX25            = FOUR_CHAR_CODE('x25 '),        /* trailing space is important! */
  1163.                                                                 /*    transport options    */
  1164.     kOTCfgTypeRemoteApp            = FOUR_CHAR_CODE('capt')
  1165. };
  1166.  
  1167. /*******************************************************************************
  1168. *    OTCfgRemoteLogOptions
  1169. *
  1170. *    This structure is appended to OTCfgRemoteConnect records in the 
  1171. *    OTCfgRemoteConnect::additional list.
  1172. *
  1173. *    NOTE
  1174. *
  1175. *    All OTCfgRemoteConnect::additional structures MUST have the same fields up to
  1176. *    the "additional" field.  See OTCfgRemoteX25Info.
  1177. ********************************************************************************/
  1178.  
  1179. struct OTCfgRemoteLogOptions {
  1180.     UInt32                             version;
  1181.     UInt32                             fType;                        /*    kRAConnectAdditionalLogOptions*/
  1182.     void *                            additional;
  1183.     UInt32                             logLevel;                    /*    values defined above.*/
  1184.     UInt32                             reserved[4];                /*    for later use.*/
  1185. };
  1186. typedef struct OTCfgRemoteLogOptions    OTCfgRemoteLogOptions;
  1187. /*******************************************************************************
  1188. *    New structures for dialing mode, phone numbers, and configuration stats.
  1189. *    
  1190. *    
  1191. ********************************************************************************/
  1192. enum {
  1193.     kOTCfgRemoteMaxAddressSize    = (255 + 1)
  1194. };
  1195.  
  1196.  
  1197. struct OTCfgRemoteAddress {
  1198.     struct OTCfgRemoteAddress *        next;
  1199.     UInt8                             address[256];
  1200. };
  1201. typedef struct OTCfgRemoteAddress        OTCfgRemoteAddress;
  1202. /*******************************************************************************
  1203. *    OTCfgRemoteDialing
  1204. *
  1205. *    This structure is appended to OTCfgRemoteConnect records in the 
  1206. *    OTCfgRemoteConnect::additional list.
  1207. *
  1208. *    NOTE
  1209. *
  1210. *    All OTCfgRemoteConnect::additional structures MUST have the same fields up to
  1211. *    the "additional" field.  See OTCfgRemoteX25Info.
  1212. ********************************************************************************/
  1213.  
  1214. struct OTCfgRemoteDialing {
  1215.     UInt32                             version;
  1216.     UInt32                             fType;                        /*    kRAConnectAdditionalDialing*/
  1217.     void *                            additional;
  1218.     UInt32                             dialMode;                    /*    values defined above.*/
  1219.     SInt32                             redialTries;
  1220.     UInt32                             redialDelay;                /*    in seconds.*/
  1221.     OTCfgRemoteAddress *            addresses;
  1222. };
  1223. typedef struct OTCfgRemoteDialing        OTCfgRemoteDialing;
  1224. /*******************************************************************************
  1225. *    OTCfgRemoteScript
  1226. *
  1227. *    This is appended to OTCfgRemoteConnect records in the "additional" list.
  1228. *    It is currently only used for passing in a modem script to override
  1229. *    the default script.  Connect scripts have their own field in OTCfgRemoteConnect.
  1230. *
  1231. *    NOTE
  1232. *
  1233. *    All OTCfgRemoteConnect::additional structures MUST have the same fields up to
  1234. *    the "additional" field.  See OTCfgRemoteX25Info and OTCfgRemoteDialing.
  1235. ********************************************************************************/
  1236.  
  1237. struct OTCfgRemoteScript {
  1238.     UInt32                             version;
  1239.     UInt32                             fType;                        /*    kRAConnectAdditionalScript*/
  1240.     void *                            additional;
  1241.     UInt32                             scriptType;
  1242.     UInt32                             scriptLength;
  1243.     UInt8 *                            scriptData;
  1244. };
  1245. typedef struct OTCfgRemoteScript        OTCfgRemoteScript;
  1246. /*******************************************************************************
  1247. *    Miscellaneous limits
  1248. *    The size limits for strings include a 1 byte for the string length or
  1249. *    a terminating NULL character.
  1250. ********************************************************************************/
  1251. enum {
  1252.     kOTCfgRemoteMaxPasswordLength = 255,
  1253.     kOTCfgRemoteMaxPasswordSize    = (255 + 1),
  1254.     kOTCfgRemoteMaxUserNameLength = 255,
  1255.     kOTCfgRemoteMaxUserNameSize    = (255 + 1),
  1256.     kOTCfgRemoteMaxAddressLength = 255,                            /*    kOTCfgRemoteMaxAddressSize                    = (255 + 1),*/
  1257.     kOTCfgRemoteMaxServerNameLength = 32,
  1258.     kOTCfgRemoteMaxServerNameSize = (32 + 1),
  1259.     kOTCfgRemoteMaxMessageLength = 255,
  1260.     kOTCfgRemoteMaxMessageSize    = (255 + 1),
  1261.     kOTCfgRemoteMaxX25ClosedUserGroupLength = 4,
  1262.     kOTCfgRemoteInfiniteSeconds    = (long)0xFFFFFFFF,
  1263.     kOTCfgRemoteMinReminderMinutes = 1,
  1264.     kOTCfgRemoteChatScriptFileCreator = FOUR_CHAR_CODE('ttxt'),
  1265.     kOTCfgRemoteChatScriptFileType = FOUR_CHAR_CODE('TEXT'),
  1266.     kOTCfgRemoteMaxChatScriptLength = 0x8000
  1267. };
  1268.  
  1269. /*******************************************************************************
  1270. *    X.25 connection information, added to OTCfgRemoteConnect's additional info list.
  1271. *
  1272. *    NOTE
  1273. *
  1274. *    All OTCfgRemoteConnect::additional structures MUST have the same fields up to
  1275. *    the "additional" field.  See OTCfgRemoteScript & OTCfgRemoteDialing.
  1276. ********************************************************************************/
  1277.  
  1278. struct OTCfgRemoteX25Info {
  1279.     UInt32                             version;
  1280.     UInt32                             fType;                        /*    kRAConnectAdditionalX25*/
  1281.     void *                            additional;                    /*    Ptr to additional connect info*/
  1282.     FSSpec                             script;                        /*    PAD's CCL script*/
  1283.     UInt8                             address[256];                /*    address of server*/
  1284.     UInt8                             userName[256];
  1285.                                                                 /*    network user ID*/
  1286.     UInt8                             closedUserGroup[5];
  1287.                                                                 /*    closed user group*/
  1288.     Boolean                         reverseCharge;                /*    request reverse charging*/
  1289. };
  1290. typedef struct OTCfgRemoteX25Info        OTCfgRemoteX25Info;
  1291. /*******************************************************************************
  1292. *    OTCfgRemoteDisconnect
  1293. *
  1294. *    Use this structure to terminate Remote Access connections.
  1295. ********************************************************************************/
  1296.  
  1297. struct OTCfgRemoteDisconnect {
  1298.     UInt32                             whenSeconds;                /*    Number of seconds until disconnect*/
  1299.     UInt32                             showStatus;                    /*    Show disconnect status window*/
  1300. };
  1301. typedef struct OTCfgRemoteDisconnect    OTCfgRemoteDisconnect;
  1302. /*******************************************************************************
  1303. *    OTCfgRemoteIsRemote
  1304. *
  1305. *    Use this structure to find out if an AppleTalk address is on the 
  1306. *    remote side of the current ARA link. The "isRemote" field is set to
  1307. *    "true" if the address is remote. 
  1308. ********************************************************************************/
  1309.  
  1310. struct OTCfgRemoteIsRemote {
  1311.     UInt32                             net;                        /*    AppleTalk network number*/
  1312.     UInt32                             node;                        /*    AppleTalk node number*/
  1313.     UInt32                             isRemote;                    /*    returned.*/
  1314. };
  1315. typedef struct OTCfgRemoteIsRemote        OTCfgRemoteIsRemote;
  1316. /*******************************************************************************
  1317. *    OTCfgRemoteConnect
  1318. *
  1319. *    Use this structure to initiate Remote Access connections.
  1320. ********************************************************************************/
  1321.  
  1322. struct OTCfgRemoteConnect {
  1323.     UInt32                             version;
  1324.     UInt32                             fType;                        /*    RAConnectType defined above.*/
  1325.     UInt32                             isGuest;                    /*    (boolean) True for guest login*/
  1326.     UInt32                             canInteract;                /*    (boolean) True if dialogs can be displayed*/
  1327.     UInt32                             showStatus;                    /*    (boolean) Display (dis)connection status dialogs?*/
  1328.     UInt32                             passwordSaved;                /*    (boolean) "Save Password" checked in doc.*/
  1329.     UInt32                             flashConnectedIcon;            /*    (boolean) Flash icon in menu bar*/
  1330.     UInt32                             issueConnectedReminders;    /*    (boolean) Use Notification Manager reminders*/
  1331.     SInt32                             reminderMinutes;            /*    How long between each reminder?*/
  1332.     UInt32                             connectManually;            /*    (boolean) True if we are connecting manually*/
  1333.     UInt32                             allowModemDataCompression;    /*    (boolean) currently, only for kSerialProtoPPP*/
  1334.     UInt32                             chatMode;                    /*    Flags defined above*/
  1335.     UInt32                             serialProtocolMode;            /*    Flags defined above*/
  1336.  
  1337.     UInt8 *                            password;
  1338.     UInt8 *                            userName;
  1339.     UInt32                             addressLength;                /*    Length of phone number or other address*/
  1340.     UInt8 *                            address;                    /*    Phone number or address data*/
  1341.     Str63                             chatScriptName;                /*    Name of imported chat script (informational only)*/
  1342.     UInt32                             chatScriptLength;            /*    Length of Chat script*/
  1343.     UInt8 *                            chatScript;                    /*    Chat script data*/
  1344.  
  1345.     void *                            additional;                    /*    Ptr to additional connect info,*/
  1346.                                                                 /*    such as OTCfgRemoteX25Info*/
  1347.  
  1348.     UInt32                             useSecurityModule;            /*    (boolean) use line-level security module ?*/
  1349.     OSType                             securitySignature;            /*    signature of security module file*/
  1350.     UInt32                             securityDataLength;            /*    0..kSecurityMaxConfigData*/
  1351.     UInt8 *                            securityData;                /*    Ptr to data of size securityDataLength*/
  1352. };
  1353. typedef struct OTCfgRemoteConnect        OTCfgRemoteConnect;
  1354. /*******************************************************************************
  1355. *    OTCfgRemoteConnectInfo
  1356. *
  1357. *    If requestCode = kRAGetConnectInfo, "connectInfo" returns a pointer to a
  1358. *    new OTCfgRemoteConnect block that describes the current connection.
  1359. *
  1360. *    If requestCode = kRADisposeConnectInfo, the memory pointed to by
  1361. *    "connectInfo" is released for reuse.  "connectInfo" must point to a valid
  1362. *    OTCfgRemoteConnect structure previously returned by kRAGetConnectInfo.
  1363. ********************************************************************************/
  1364.  
  1365. struct OTCfgRemoteConnectInfo {
  1366.     OTCfgRemoteConnect *            connectInfo;                /*    Returned or disposed, depending on requestCode*/
  1367. };
  1368. typedef struct OTCfgRemoteConnectInfo    OTCfgRemoteConnectInfo;
  1369. /*******************************************************************************
  1370. *    OTCfgRemoteStatus
  1371. *
  1372. *    Use this structure to get the status of Remote Access connections.
  1373. ********************************************************************************/
  1374. enum {
  1375.     kOTCfgRemoteStatusIdle        = 1,
  1376.     kOTCfgRemoteStatusConnecting = 2,
  1377.     kOTCfgRemoteStatusConnected    = 3,
  1378.     kOTCfgRemoteStatusDisconnecting = 4
  1379. };
  1380.  
  1381.  
  1382.  
  1383. struct OTCfgRemoteStatus {
  1384.     UInt32                             status;                        /*    values defined above*/
  1385.     Boolean                         answerEnabled;
  1386.     char                             pad00;                        /*    This structure is NOT packed*/
  1387.     UInt32                             secondsConnected;
  1388.     UInt32                             secondsRemaining;
  1389.     UInt8                             userName[256];                /*    Pascal format*/
  1390.     UInt8                             serverName[33];                /*    Pascal format*/
  1391.     char                             pad01;                        /*    This structure is NOT packed*/
  1392.     UInt32                             messageIndex;
  1393.     UInt8                             message[256];                /*    Pascal format*/
  1394.     UInt32                             serialProtocolMode;            /*    Flags defined above.*/
  1395.     UInt8                             baudMessage[256];            /*    Pascal format*/
  1396.     Boolean                         isServer;
  1397.     char                             pad02;                        /*    This structure is NOT packed*/
  1398.     UInt32                             bytesIn;
  1399.     UInt32                             bytesOut;
  1400.     UInt32                             linkSpeed;
  1401.     UInt32                             localIPAddress;
  1402.     UInt32                             remoteIPAddress;
  1403. };
  1404. typedef struct OTCfgRemoteStatus        OTCfgRemoteStatus;
  1405. /*******************************************************************************
  1406. *    OTCfgRemoteUserMessage
  1407. *
  1408. *    Use this structure when converting result codes into user messages.
  1409. ********************************************************************************/
  1410.  
  1411. struct OTCfgRemoteUserMessage {
  1412.     UInt32                             version;
  1413.     SInt32                             messageID;
  1414.     UInt8                             userMessage[256];
  1415.     UInt8                             userDiagnostic[256];
  1416. };
  1417. typedef struct OTCfgRemoteUserMessage    OTCfgRemoteUserMessage;
  1418. /*******************************************************************************
  1419. *    OTCfgRemoteNotifier
  1420. *
  1421. *    Use this structure to install a procedure to receive asynchronous 
  1422. *    Remote Access notifications.
  1423. ********************************************************************************/
  1424.  
  1425. typedef UInt32                             OTCfgRemoteEventCode;
  1426. typedef CALLBACK_API_C( void , RANotifyProcPtr )(void *contextPtr, OTCfgRemoteEventCode code, OSStatus result, void *cookie);
  1427.  
  1428. struct OTCfgRemoteNotifier {
  1429.     RANotifyProcPtr                 procPtr;
  1430.     void *                            contextPtr;
  1431. };
  1432. typedef struct OTCfgRemoteNotifier        OTCfgRemoteNotifier;
  1433. /*******************************************************************************
  1434. *    OTCfgRemoteRequest
  1435. *
  1436. *    All Remote Access API calls must pass a pointer to an OTCfgRemoteRequest structure.
  1437. ********************************************************************************/
  1438.  
  1439. struct OTCfgRemoteRequest {
  1440.     SInt8                             reserved1[16];                /*    Do not use. */
  1441.     OSErr                             result;                        /*    <--*/
  1442.     SInt8                             reserved2[8];                /*    Do not use.*/
  1443.     SInt16                             requestCode;                /*     -->*/
  1444.     SInt16                             portId;                        /*    <-->*/
  1445.     union {
  1446.         OTCfgRemoteNotifier             Notifier;
  1447.         OTCfgRemoteConnect                 Connect;
  1448.         OTCfgRemoteDisconnect             Disconnect;
  1449.         OTCfgRemoteStatus                 Status;
  1450.         OTCfgRemoteIsRemote             IsRemote;
  1451.         OTCfgRemoteConnectInfo             ConnectInfo;
  1452.     }                                 fType;
  1453. };
  1454. typedef struct OTCfgRemoteRequest        OTCfgRemoteRequest;
  1455.  
  1456. struct OTCfgRemoteConfigCAPT {
  1457.     UInt32                             fWord1;
  1458.     Point                             fWindowPosition;
  1459.     UInt32                             fWord3;
  1460.     UInt32                             fUserLevel;
  1461.     UInt32                             fSetupVisible;
  1462. };
  1463. typedef struct OTCfgRemoteConfigCAPT    OTCfgRemoteConfigCAPT;
  1464. #endif  /* CALL_NOT_IN_CARBON */
  1465.  
  1466.  
  1467. #if PRAGMA_STRUCT_ALIGN
  1468.     #pragma options align=reset
  1469. #elif PRAGMA_STRUCT_PACKPUSH
  1470.     #pragma pack(pop)
  1471. #elif PRAGMA_STRUCT_PACK
  1472.     #pragma pack()
  1473. #endif
  1474.  
  1475. #ifdef PRAGMA_IMPORT_OFF
  1476. #pragma import off
  1477. #elif PRAGMA_IMPORT
  1478. #pragma import reset
  1479. #endif
  1480.  
  1481. #ifdef __cplusplus
  1482. }
  1483. #endif
  1484.  
  1485. #endif /* __NETWORKSETUP__ */
  1486.  
  1487.